<template>
    <van-sticky :offset-top="0">
        <van-nav-bar title="搜索" left-text="返回" left-arrow @click-left="onClickLeft" />
    </van-sticky>
    <van-search v-model="value" placeholder="请输入搜索关键词"></van-search>
    <template v-if="value.length == 0 || ssdata == 0">
        <van-empty description="暂无数据" />

    </template>
    <template v-else>
        <van-cell v-for="i in ssdata" :title="i.goods_name"  />
    </template>


</template>

<script setup>
import { ref, watch } from 'vue';
import { useRouter } from 'vue-router';
let router=useRouter()
const onClickLeft = () => router.go(-1);
import { ss } from '@/api/api';
import _ from 'lodash'

const value = ref('');
let ssdata = ref({})
watch(value, _.debounce((value) => {
    ss(value).then(res => {
        console.log('搜索', res)
        ssdata.value = res.data.message
    })
},1500))

</script>

<style lang="scss" scoped></style>